package fy.mdm.operator;

import com.seeyon.v3x.services.flow.bean.FlowExport;
import com.seeyon.v3x.services.form.bean.ValueExport;
import fy.form.listen.operate.AForm_Save_Operator;
import fy.form.listen.operate.IFormOperator;
import fy.mdm.bean.FYESupplierBean;
import fy.mdm.bean.PartEditCustomerBean;
import fy.mdm.dao.FYESupplierDao;
import fy.mdm.dao.FiexdAssetReviewDao;
import fy.mdm.dao.PartEditCustomerDao;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.text.SimpleDateFormat;
import java.util.Date;

public class FYESupplierOperator extends AForm_Save_Operator implements
        IFormOperator {
    private static Log log = LogFactory.getLog(FiexdAssetReviewDao.class);
    private FYESupplierBean bean = new FYESupplierBean();
    @Override
    public String getFormName() {
        return "配件客户修改申请表";
    }
    @Override
    protected void parseOtherField_FirstStep(FlowExport flowExport) {

    }
    @Override
    protected void parseValueExport(ValueExport ve) {

        String fieldName = ve.getDisplayName();
        log.info("fieldName:"+fieldName+"="+ve.getValue());
        if ("供应商编码".equals(fieldName)) {
            bean.setVenderCode(ve.getValue());
        } else if ("供应商名称".equals(fieldName)) {
            bean.setVenderName(ve.getValue());
        }
    }

    @Override
    protected boolean save() {
        try {
            FYESupplierDao fyeSupplierDao = new FYESupplierDao();
            fyeSupplierDao.setFYESupplierBean(bean);
            return fyeSupplierDao.getStateReturn();

        } catch (Exception e) {
            e.printStackTrace();
        }finally {

        }
        return success;
    }
}
